package com.come4loves.game.dbproxy.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.come4loves.core.dbcenter.DBQueueType;
import com.come4loves.core.dbcenter.Entity;
import com.come4loves.core.dbcenter.annotation.Column;
import com.come4loves.core.dbcenter.annotation.Table;
@Table(name = "uid_actor", type=DBQueueType.DEFAULT)
public class UidActorID extends Entity<String>{
	/**
	 * 
	 */
	private static final long serialVersionUID = -4693738499202053064L;
	@Column(pk = true)
	private String uid;
	@Column
	private long actorId;
	@Override
	public String getPkId() {
		return uid;
	}

	@Override
	public void setPkId(String pk) {
		this.uid = pk;
	}

	@Override
	protected Entity<String> readData(ResultSet rs, int rowNum) throws SQLException {
		UidActorID uidActorID = new UidActorID();
		uidActorID.uid = rs.getString("uid");
		uidActorID.actorId = rs.getLong("actorId");
		return uidActorID;
	}

	@Override
	protected void hasReadEvent() {
		
	}

	@Override
	protected ArrayList<Object> writeData(Boolean containsPK) {
		ArrayList<Object> values = new ArrayList<Object>();
		if (containsPK) {
			values.add(this.uid);
		}
		values.add(this.actorId);
		return values;
	}

	@Override
	protected void beforeWritingEvent() {
		
	}

	@Override
	protected void disposeBlob() {
		
	}
	
	public long getActorId() {
		return actorId;
	}
	
	public void setActorId(long actorId) {
		this.actorId = actorId;
	}

}
